package com.aliothservice.catfish.device;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.timeout.ReadTimeoutHandler;

public class CollectorTimeoutAdapter extends ReadTimeoutHandler {

	public CollectorTimeoutAdapter(int timeoutSeconds) {
		super(timeoutSeconds);
	}

	@Override
	public void exceptionCaught(ChannelHandlerContext context, Throwable cause) throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("exception caught - " + cause.getMessage().toString());
		}
		context.close();
		super.exceptionCaught(context, cause);
	}
	
	private static final Logger logger = LoggerFactory.getLogger(CollectorTimeoutAdapter.class);
	
}
